QT += core gui widgets qml quick sql serialbus charts
CONFIG += c++17

# 应用程序信息
TARGET = ModbusTCPMonitor
TEMPLATE = app

# 定义应用程序版本
DEFINES += APP_VERSION=\\\"1.0.0\\\"

# C++17 标准
QMAKE_CXXFLAGS += -std=c++17

# 包含路径
INCLUDEPATH += src \
               src/controllers \
               src/models \
               src/services \
               src/entities \
               src/utils

# 源文件
SOURCES += \
    src/main.cpp \
    src/services/DatabaseService.cpp \
    src/services/ModbusService.cpp \
    src/services/DataCollector.cpp \
    src/services/CsvExporter.cpp \
    src/entities/Device.cpp \
    src/entities/DataPoint.cpp \
    src/entities/AlarmRecord.cpp \
    src/models/DeviceModel.cpp \
    src/models/DataRecordModel.cpp \
    src/models/HistoryModel.cpp \
    src/models/AlarmModel.cpp \
    src/controllers/ModbusController.cpp \
    src/controllers/DataController.cpp \
    src/controllers/AlarmController.cpp \
    src/controllers/SettingsController.cpp \
    src/utils/Config.cpp \
    src/utils/Logger.cpp \
    src/utils/ModbusHelper.cpp

# 头文件
HEADERS += \
    src/services/DatabaseService.h \
    src/services/ModbusService.h \
    src/services/DataCollector.h \
    src/services/CsvExporter.h \
    src/entities/Device.h \
    src/entities/DataPoint.h \
    src/entities/AlarmRecord.h \
    src/models/DeviceModel.h \
    src/models/DataRecordModel.h \
    src/models/HistoryModel.h \
    src/models/AlarmModel.h \
    src/controllers/ModbusController.h \
    src/controllers/DataController.h \
    src/controllers/AlarmController.h \
    src/controllers/SettingsController.h \
    src/utils/Config.h \
    src/utils/Logger.h \
    src/utils/ModbusHelper.h

# QML 资源文件
RESOURCES += \
    resources/qml.qrc

# 默认部署规则
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

# 编译输出目录
DESTDIR = $$PWD/bin
OBJECTS_DIR = $$PWD/build/obj
MOC_DIR = $$PWD/build/moc
RCC_DIR = $$PWD/build/rcc
UI_DIR = $$PWD/build/ui

# 警告级别
QMAKE_CXXFLAGS += -Wall -Wextra

# Release 配置优化
CONFIG(release, debug|release) {
    DEFINES += QT_NO_DEBUG_OUTPUT
    QMAKE_CXXFLAGS += -O2
}

# Debug 配置
CONFIG(debug, debug|release) {
    DEFINES += DEBUG_MODE
}

